package com.cxs.task;

import com.alibaba.fastjson.JSON;
import com.cxs.service.WechatService;
import com.cxs.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Project: wechat-push
 * @Author: cxs2014501@163.com
 * @Create: 2023/9/7 15:16
 * @Description:
 **/
@Slf4j
@Component
public class SendMsgTask {

    @Autowired
    private WechatService wechatService;

    @Scheduled(cron = "${scheduled.cron}")
    public void sendMsg(){
        Result result = wechatService.pushEveryMsg();
        log.info("result:{}", JSON.toJSONString(result));
    }
}
